﻿using System;
using System.Collections.Generic; 
using NTTDATA.BEENChina.ResultCertification.Config; 

namespace NTTDATA.BEENChina.ResultCertification.Checker.Text
{
    [Serializable]
    [VerfityAttribute(Id = "VerfityTX0401", Name = "规则检证:SLK复合检证(KJ栏无记载，手术栏有KJ)", CategoryType = EnumCategoryType.文字列, Model = true)]
    public class VerfityTx0401 : VerfityOneResult
    {
        

        public override bool CheckResult(List<List<string>> result, string entryCommon)
        {
            bool bresult = false;

            if (entryCommon == "30"  ||
                 entryCommon == "20")
            {
                return false;
            }

            foreach (var rowResult in result)
            {
                foreach (var colResult in rowResult)
                {

                    bresult = CheckErrorResult(colResult);

                    if (bresult)
                        break;
                }

                if (bresult)
                    break;
            }


            if (bresult)
            {
                System.Console.WriteLine("VerfityTX0401"); 
            }
            return bresult;
        }

        /// <summary>
        /// KJ栏无记载，手术栏有KJ :true 
        /// </summary>
        /// <param name="colResult"></param>
        /// <returns></returns>
        private bool CheckErrorResult(string colResult)
        {

            var splitEntryResult = new Split.SplitEntryResult(ChildImageObject.CategorySetting.DataFormat, colResult);

            //手术名部分
            string ssmCell = splitEntryResult.GetShouShuMing();
            string kjCell = splitEntryResult.GetKjCell();

            if (String.IsNullOrEmpty(kjCell))
            {
                if (ssmCell.Contains("KJ"))
                    return true;
            }
          　
            return false;
        }


    }
}